import React from "react";
import { RouteObject, useRoutes } from "react-router-dom";
import { Links } from "./constants";
import Demo from "../pages/demo";
import Layout from "../components/Layout";
import Home from "../pages/home";
import Container from "../pages/container";

/** 集中配置路由 */
const routes: RouteObject[] = [
  {
    path: Links.Layout,
    element: <Layout />,
    children: [
      {
        index: true,
        element: <Home />,
      },
      {
        path: Links.Container,
        element: <Container />,
      },
    ],
  },
  {
    path: Links.Demo,
    element: <Demo />,
  },
];
const RoutesComponent = () => {
  return useRoutes(routes);
};

export default RoutesComponent;
